//
//  tools.m
//  idoctor
//
//  Created by Mr Lee on 2017/6/1.
//  Copyright © 2017年 Mr Lee. All rights reserved.
//

#import "tools.h"

@implementation tools

+ (NSString *)interceptTimeStampFromStr:(NSString *)str{
    if (!str || [str length] == 0 ) {  // 字符串为空判断
        return @"";
    }

    // 把时间戳转化成时间
    NSTimeInterval interval=[str doubleValue] / 1000.0;
    NSDate *date = [NSDate dateWithTimeIntervalSince1970:interval];
    NSDateFormatter *objDateformat = [[NSDateFormatter alloc] init];
    [objDateformat setDateFormat:@"yyyy/MM/dd"];
    NSString * timeStr = [NSString stringWithFormat:@"%@",[objDateformat stringFromDate: date]];
    return timeStr;
}

@end
